Mac PHPStorm 调试
安装xdebug
- 获取PHP安装信息
1 | php -i |
在终端运行以上语句并拷贝输出信息。
在浏览器中打开 https://xdebug.org/wizard.php 地址,并粘贴php信息。提交后,将出现安装指南的页面。
根据页面指示操作安装。
Download xdebug-2.5.1.tgz
Unpack the downloaded file with
tar -xvzf xdebug-2.5.1.tgz
Run:
cd xdebug-2.5.1
Run:
phpize
(See the FAQ if you don’t havephpize
.As part of its output it should show:
1
2
3
4Configuring for:
...
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
If it does not, you are using the wrong
phpize
. Please follow this FAQ entry and skip the next step.Run:
./configure
Run:
make
Run:
cp modules/xdebug.so /usr/local/Cellar/php56/5.6.30_6/lib/php/extensions/no-debug-non-zts-20131226
Edit
/usr/local/etc/php/5.6/php.ini
and add the linezend_extension = /usr/local/Cellar/php56/5.6.30_6/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
- 重启你的Web服务器(Apache、Nginx或者其他)。
PHPStorm配置
参见网上资料
疑难
- PHPStorm服务器的配置就是你原来的Web服务器地址和端口;
- xdebug的端口要与配置的一直,用默认的9000就可以了;
- 使用Chrome调试,请安装Xdebug helper以及JetBrains IDE Support插件;